<template>
  <div ref="print">
    <!-- 查询 -->
    <el-popover placement="bottom-start" trigger="click" >
      <el-form :inline="true" :model="searchList" label-width="80px" class="search-panle">
        <el-form-item label="小样号" class="noMargin"><el-input v-model="searchList.smallNo" ></el-input></el-form-item>
        <el-form-item label="浆员姓名" class="noMargin"><el-input v-model="searchList.name" ></el-input></el-form-item>
        <el-form-item label="创建日期" class="noMargin"> <el-date-picker v-model="searchList.time" type="date" @change='dateChange' placeholder="选择日期" class="noMargin"></el-date-picker></el-form-item>
        <el-button type="primary" @click="searchData" class="searchBtn">提交</el-button>
      </el-form>
      <el-button slot="reference" type="primary" >查询</el-button>
      <el-button slot="reference" @click="ceditDialog = true" type="primary" style="float:right;" >操作</el-button>
    </el-popover>
    <!-- 表格 -->
    <el-table :data="tableData" stripe border class="company-table" :height="tableHeight" v-loading="loading" v-show="true">
      <el-table-column fixed type="index" label="*"  align="center" min-width="40"></el-table-column>
      <el-table-column prop="sampleNo" label="小样号"  min-width="130"></el-table-column>
      <el-table-column prop="name" label="浆员姓名"  min-width="110"></el-table-column>
      <el-table-column prop="authMethod" label="认证方式" :formatter='formatterAuthMethod'  min-width="130"></el-table-column>
      <el-table-column prop="sampleType" label="小样类型"  :formatter='sampleTypeFormat'></el-table-column>
      <el-table-column prop="inspectionRecodePersonName" label="化检记录人"  min-width="110"></el-table-column>
      <el-table-column prop="recodeStatusName" label="记录状态"  min-width="110"></el-table-column>
      <el-table-column prop="inspectionResultName" label="化检结果"  min-width="110"></el-table-column>
      <el-table-column fixed="right" label="操作" align="center" min-width="75">
          <template slot-scope="scope">
              <el-button  @click="updateDialog(scope.row)" type="text" size="small"> {{ scope.row.inspectionStatus !='1' ? '编辑' : '详情'  }} </el-button>
          </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pagination.currentPage" :page-sizes="[10, 15,20, 25,30,50, 100]" :page-size="pagination.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"></el-pagination>
    <!-- 详情 -->
    <el-dialog :title="dialog.title" :visible.sync="dialog.isShow" width="1080px" top="40px" :close-on-click-modal="false" class="dialog-form">
      <div :style="{'height':(tableHeight-90)+'px','overflow-y':'auto'}">
        <h3 class="dialog-plate-title"><span>基本信息</span></h3>
        <!-- 浆员基本信息 -->
        <pulpwork-info v-bind:cardid="dialogData.providerNo"></pulpwork-info>
        <h3 class="dialog-plate-title" ><span>小样信息</span></h3>
        <el-form :inline="true" :model="dialogData" label-width="120px">
          <el-form-item label="小样号"><el-input v-model="dialogData.sampleNo" disabled></el-input></el-form-item>
          <el-form-item label="小样类型"><el-input v-model="dialogData.sampleTypeFormatter" disabled></el-input></el-form-item>
          <el-form-item label="认证方式"><el-input v-model="dialogData.authMethodFormatter " disabled></el-input></el-form-item>
          <el-form-item label="采集时间"><el-input v-model="dialogData.gatheringTime" disabled></el-input></el-form-item>
          <el-form-item label="采集地点"><el-input v-model="dialogData.gatheringPlaceFormatter" disabled></el-input></el-form-item>
          <el-form-item label="记录时间"><el-input v-model="dialogData.recodeTIme" disabled></el-input></el-form-item>
          <el-form-item label="创建护士"><el-input v-model="dialogData.createNurseName" disabled></el-input></el-form-item>
        </el-form>

        <h3 class="dialog-plate-title"><span>化检项目</span></h3>
        <el-form   :inline="true" :model="dialogData" label-width="120px">
          <el-form-item label="全血比重"><el-select v-model="dialogData.wholeBloodLevel" class="selectW200"><el-option value="" label="【空】"></el-option><el-option v-for="item in codeData18" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
          <el-form-item label="蛋白含量"><el-input v-model="dialogData.proteinLevel" ></el-input></el-form-item>
          <el-form-item label="血清蛋白含量"><el-input v-model="dialogData.serumProteinLevel" ></el-input></el-form-item>
          <el-form-item label="血红蛋白含量"><el-select v-model="dialogData.hemoglobinLevel" class="selectW200"><el-option value="" label="【空】"></el-option><el-option v-for="item in codeData17" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
          <el-form-item label="HBsAg"><el-select v-model="dialogData.hbsAg" class="selectW200"><el-option v-for="item in codeData20" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
          <el-form-item label="抗-HCV"> <el-select v-model="dialogData.hcv" class="selectW200"><el-option v-for="item in codeData20" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
          <el-form-item label="梅毒"><el-select v-model="dialogData.syphilis" class="selectW200"><el-option v-for="item in codeData20" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
          <el-form-item label="抗-HIV"><el-select v-model="dialogData.hiv" class="selectW200"><el-option v-for="item in codeData20" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
          <el-form-item label="ALT"><el-select v-model="dialogData.alt" class="selectW200"><el-option value="" label="【空】"></el-option><el-option v-for="item in codeData21" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
          <el-form-item label="血型"><el-select v-model="dialogData.bloodType" class="selectW200"><el-option value="" label="【空】"></el-option><el-option v-for="item in codeData12" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
          <el-form-item label="化检备注"><el-input v-model="dialogData.inspectionRemark" type="textarea" class="checkNote" :rows="1"></el-input></el-form-item>
        </el-form>
        <h3 class="dialog-plate-title" ><span>化检详情</span></h3>
        <el-form  :inline="true" :model="dialogData" label-width="120px">
          <el-form-item label="化检结果">
            <el-select v-model="dialogData.inspectionResult" class="selectW200">
              <el-option value="" label="【空】"></el-option>
              <el-option v-for="item in codeData18" :key="item.code" :value="item.code" :label="item.name"></el-option>
              </el-select>
            </el-form-item>
          <el-form-item label="" >
            <el-radio-group v-model="dialogData.ym" disabled>
              <el-radio label="1">液面上</el-radio>
              <el-radio label="2">液面下</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="折射仪刻度值"><el-input v-model="dialogData.zsykdz" disabled></el-input></el-form-item>
          <el-form-item label="化验开始时间"><el-date-picker v-model="dialogData.inspectionStartTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker></el-form-item>
          <el-form-item label="化验结束时间"><el-date-picker v-model="dialogData.inspectionEndTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker></el-form-item>
          <el-form-item label="记录处理时间"><el-date-picker v-model="dialogData.recodeEndTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker></el-form-item>
          <el-form-item label="化检记录人"><el-input v-model="dialogData.inspectionRecodePersonName" disabled></el-input></el-form-item>
          <el-form-item label="记录创建时间"><el-input v-model="dialogData.recodeStartTime" disabled></el-input></el-form-item>
        </el-form>
      </div>
      <div slot="footer">
          <el-button v-if="dialogData.inspectionStatus !='1' " type="primary" @click="submitDialog">提交</el-button>
      </div>
    </el-dialog>
    <!-- 操作弹出层 -->
    <el-dialog  title="操作选项" :visible.sync="ceditDialog" width='500px' :close-on-click-modal='false' v-dialogDrag>
          <el-form class="editDialog">
             <el-form-item label="化验日期:">
               <el-input class="HYDay" v-model="CZForm.HYDay" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="操作类型:">
                <el-select v-model="CZForm.BJSelect" placeholder="请选择操作类型">
                  <el-option
                    v-for="item in BJOption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
            </el-form-item>
             <el-form-item label="报表类型:">
                <el-select v-model="CZForm.BBSelect" placeholder="请选择报表类型">
                  <el-option
                    v-for="item in BBOption"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
            </el-form-item>
          </el-form>
           <div style="padding-bottom: 20px;"><el-button @click="ceditSub" type="primary" style="float:right;" size="medium">确定</el-button></div>
    </el-dialog>
    <!-- pdf 数据tab表(注：pdf 打印的A4纸宽度为720px) -->
    <div v-show="true" class="wid100">
      <!-- 血红蛋白含量 -->
      <div ref="print_1" class="wid100 psfBox1">
        <div class="psfTitle">{{PDFData.formHeader}}</div>
        <div class="psfDate">化验日期：{{PDFData.assayDate}}</div>
        <!-- <div v-for="(item,index) in PDFData.xhdbList" :key="index"> -->
        <el-table  border :data="PDFData.xhdbList">
          <el-table-column label="小样编号" width="100" align='center'>
            <template slot-scope="scope"><div>{{scope.row.smallNo | Ssubstr}}</div></template>
          </el-table-column>
          <el-table-column prop="cardId" label="供血浆者卡号" width="130" align='center'></el-table-column>
          <el-table-column prop="providerName" label="供血浆者姓名" width="130" align='center'></el-table-column>
          <el-table-column prop="gender" label="性别" width="65" align='center'></el-table-column>
           <el-table-column label="硫酸铜液中血滴状态">
            <el-table-column label="液面下" width="80" align='center'><template slot-scope="scope"><span v-if="scope.row.ym == 1">是</span></template></el-table-column>
            <el-table-column label="液面上" width="80" align='center'><template slot-scope="scope"><span v-if="scope.row.ym == 0">是</span></template></el-table-column>
            <!-- <el-table-column label="液面下" width="80" align='center'><template slot-scope="scope"><img :src="PDFcheck" style="width: 20px;" v-if="scope.row.ym == 1"></template></el-table-column>
            <el-table-column label="液面上" width="80" align='center'><template slot-scope="scope"><img :src="PDFcheck" style="width: 20px;" v-if="scope.row.ym == 0"></template></el-table-column> -->
            <!-- <el-table-column label="液面下" width="80" align='center'><template slot-scope="scope"><span v-if="scope.row.ym == 1" style="width: 10px;height: 10px;border-radius: 50%;display: block;background-color: #000;"></span></template></el-table-column>
            <el-table-column label="液面上" width="80" align='center'><template slot-scope="scope"><span v-if="scope.row.ym == 0" style="width: 10px;height: 10px;border-radius: 50%;display: block;background-color: #000;"></span></template></el-table-column> -->
          </el-table-column>
          <el-table-column label="比重判定" align='center'>
            <el-table-column label="结果（g/L）" prop="decideResult" width="140" align='center'></el-table-column>  
          </el-table-column>
        </el-table>
        <!-- </div> -->
        <div class="customTable">
          <table border="1" cellspacing="0" cellpadding="0" bordercolor="#EBEEF5">
            <tr>
              <td rowspan='3' width='219px;'>血红蛋白检测试剂</td>
              <td width="117px"> 批号</td>
              <td width="106px">{{xhdbReagent.batchNum}} </td>
              <td width="98px">有效期至</td>
              <td width="130px">{{xhdbReagent.overdueDate}}</td>
            </tr>
             <tr>
              <td width="117px"> 环境温度要求</td>
              <td> ℃</td>
              <td>检测环境温度</td>
              <td>℃</td>
            </tr>
            <tr>
              <td width="117px"> 生产厂家 </td>
              <td colspan="3">{{xhdbReagent.manufacturerName}} </td>
            </tr>
             <tr>
              <td rowspan='2' colspan="2" width="117px"> 硫酸铜比重测定(合格) </td>
              <td colspan="3">{{PDFData.lstbzMale}} </td>
            </tr>
             <tr>
              <td colspan="3">{{PDFData.lstbzFaMale}} </td>
            </tr>
          </table>
        </div>
        <div>
          <el-row :gutter="20">
            <el-col :span="6"> 检测人数：{{PDFData.total}} 人 </el-col>
             <el-col :span="6">合格人数：{{PDFData.qualified}} 人  </el-col>
             <el-col :span="6">男性：{{PDFData.maleTotal}} 人 </el-col>
             <el-col :span="6">女性：{{PDFData.famaleTotal}} 人 </el-col>
             <el-col :span="12">检测者：{{PDFData.checkPName}} </el-col>
             <el-col :span="12">核对者：{{PDFData.collatePName}}  </el-col>
          </el-row>
        </div>
      </div>
      <!-- 血红蛋白检测 -->
      <div ref="print_2" v-show="false" class="wid100 psfBox1">
        <div class="psfTitle">{{PDFData.formHeader}}</div>
        <div class="psfDate">{{PDFData.assayDate}}</div>
        <el-table :data="PDFData.xhdbList" border >
          <el-table-column label="小样号" width="100" align='center'>
            <template slot-scope="scope"><div>{{scope.row.smallNo | Ssubstr}}</div></template>
          </el-table-column>
          <el-table-column prop="cardId" label="供血浆者卡号" width="130" align='center'></el-table-column>
          <el-table-column prop="providerName" label="姓名" width="130" align='center'></el-table-column>
          <el-table-column prop="gender" label="性别" width="65" align='center'></el-table-column>
          <el-table-column prop="checkResult" label="检测值" width="160" align='center'></el-table-column>
          <el-table-column prop="decideResult" label="结果判定" width="140" align='center'></el-table-column>
        </el-table>
        <div class="customTable">
          <table border="1" cellspacing="0" cellpadding="0" bordercolor="#EBEEF5">
            <tr>
              <td width="172px"> 试剂厂家</td>
              <td width="170px"> </td>
              <td width="170px">批 号</td>
              <td width="172px"></td>
            </tr>
            <tr>
              <td width="170px"> 化验者</td>
              <td width="170px"> </td>
              <td width="170px">有效期</td>
              <td width="172px"></td>
            </tr>
            
          </table>
        </div>
      </div>
         <!-- 化验记录 -->
      <div ref="print_3" v-show="false" class="wid100 psfBox1">
        <div class="psfTitle">{{PDFData.formHeader}}</div>
        <el-row :gutter="20">
          <el-col :span="8">
            标本信息：全血和浆样标本
          </el-col>
            <el-col :span="8">
            样本送检日期： {{PDFData.sendAssayDate}}
          </el-col>
            <el-col :span="8">
            检测日期： {{PDFData.assayDate}}
          </el-col>
        </el-row>
        <el-table :data="PDFData.assayResultList" border>
          <el-table-column prop="cardId" label="供血浆者卡号" width="67" align='center'></el-table-column>
            <el-table-column label="小样号" width="40" align='center'>
            <template slot-scope="scope"><div>{{scope.row.smallNo | Ssubstr}}</div></template>
          </el-table-column>
          <el-table-column prop="providerName" label="姓名" width="70" align='center'></el-table-column>
          <el-table-column prop="gender" label="性别" width="50" align='center'></el-table-column>
          <el-table-column prop="plasmaType" label="类型" width="50" align='center'></el-table-column>
          <el-table-column prop="bloodType" label="血型" width="50" align='center'></el-table-column>
          <el-table-column prop="hbsag" label="HBsAg" width="50" align='center'></el-table-column>
          <el-table-column prop="hcv" label="抗-HCV" width="50" align='center'></el-table-column>
          <el-table-column prop="hiv" label="抗-HIV" width="50" align='center'></el-table-column>
          <el-table-column prop="syphilis" label="梅毒" width="50" align='center'></el-table-column>
          <el-table-column prop="alt" label="ALT" width="50" align='center'></el-table-column>
          <el-table-column prop="qxbz" label="全血比重" width="50" align='center'></el-table-column>
          <el-table-column prop="dbhl" label="蛋白含量g/L" width="50" align='center'></el-table-column>
          <el-table-column prop="checkResult" label="检测结论" width="50" align='center'></el-table-column>
        </el-table>
        <div class="customTable customTable1">
          <table border="1" cellspacing="0" cellpadding="0" bordercolor="#EBEEF5" style="font-size: 10px;">
            <tr>
              <td rowspan='3' width="50px">试剂</td>
              <td width="50px">厂名</td>
              <td width="70px" v-for="(item,id) in PDFData.assayReagentList" :key="id">{{item.manufacturerName}}</td>
              <td width="60px"></td>
              <td width="60px"></td>
            </tr>
            <tr>
              <td>批号</td>
              <td v-for="(item,id) in PDFData.assayReagentList" :key="id">{{item.batchNum}}</td>
              <td></td>
              <td></td>
            </tr>
            <tr>
              <td> 有效期</td>
              <td v-for="(item,id) in PDFData.assayReagentList" :key="id">{{item.overdueDate}}</td>
              <td></td>
              <td></td>
            </tr>
            <tr>
              <td rowspan='3'> 工作人员</td>
              <td> 检测者</td>
              <td v-for="(item,id) in PDFData.assayReagentList" :key="id">{{item.checkPName}}</td>
              <td></td>
              <td></td>
            </tr>
            <tr>
              <td> 复核者</td>
              <td v-for="(item,id) in PDFData.assayReagentList" :key="id">{{item.collatePName}}</td>
              <td></td>
              <td></td>
            </tr>
              <tr>
              <td> 报告者</td>
              <td v-for="(item,id) in PDFData.assayReagentList" :key="id">{{item.reportPName}}</td>
              <td></td>
              <td></td>
            </tr>
              <tr>
              <td colspan="2"> 检测方法</td>
              <td v-for="(item,id) in PDFData.assayReagentList" :key="id">{{item.checkFun}}</td>
              <td></td>
              <td></td>
            </tr>
            <tr>
              <td colspan="5"> 检测合格数: {{PDFData.total}} (份) ； 不合格和复检数: {{PDFData.notQualified}} (份)</td>
              <td colspan="3">检测样本总数：</td>
              <td colspan="3">{{PDFData.qualified}} (份)</td>
            </tr>
              <tr>
              <td colspan="11"> 
                <el-row>
                  <el-col :span="8">
                    报告核对者：___________
                  </el-col>
                    <el-col :span="8">
                    报告审核者：___________
                  </el-col>
                    <el-col :span="8">
                    日期：
                  </el-col>
                </el-row>
              </td>
            </tr>
          </table>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import api from 'plugins/axios/api.js';
import pulpworkInfo from 'views/operationManage/components/pulpworkInfo.vue';
// 导入图片
import PDFcheck from 'images/PDFcheck.png';
export default {
  name: "sample",
  components:{
      pulpworkInfo
  },
  filters:{
    Ssubstr:function(val){
      return parseInt(val.substr(8))
    },
  },
  data(){
    return {
      codeData17:[],
      codeData12:[],
      codeData18:[],
      codeData20:[],
      codeData21:[],
      /** 搜索*/
      searchList:{
        smallNo:'',/** 小样号*/
        name:'',/** 浆员姓名*/
        time:'2019-07-03'/**时间*/
      },
      // 操作弹出层
      ceditDialog:false,
      BJOption:[
        { value: 1,label: '打印'},{ value: 2,label: '导出Excel'}
      ],
        // 血红蛋白含量pdf
      PDFData:{
        xhdbList:[]
      },
      xhdbReagent:{
        batchNum: "",checkTemperature: null,manufacturerName: "",overdueDate: "",saveTemperature: null,
      },
      
      BBOption:[
        { value: 1,label: '血红蛋白含量'},{ value: 2,label: '血红蛋白检测'},{ value: 3,label: '化检记录表'}
      ],
      CZForm:{HYDay:this.timestampToTime(Date.parse(new Date()), "yy-mm-dd"),BJSelect:1,BBSelect:1},
      PDFcheck,
      loading:false,/**数据请求中 */
      tableData:[],
      pagination:{/**分页参数 */
        currentPage:1,
        pageSize: 10,
        total:0
      },
      dialog:{/**弹框配置参数 */
        isShow:false,
        title:'详细信息'
      },
      sampleTypeFormat(row, column, cellValue, index){/**格式化小样类型 */
        return cellValue===0?'血浆':(cellValue===1?'血液':'');
      },
      dialogData:{},
    }
  },
  computed:{
    tableHeight(){
      return this.$store.state.clientHeight-184;
    }
  },
  created(){
    let self = this;
    api.getCodeData(17).then(res=>{
      self.codeData17=res.content;
    })
    api.getCodeData(12).then(res=>{
      self.codeData12=res.content;
    })
    api.getCodeData(18).then(res=>{
      self.codeData18=res.content;
    })
    api.getCodeData(20).then(res=>{
      self.codeData20=res.content;
    })
    api.getCodeData(21).then(res=>{
      self.codeData21=res.content;
    })
    self.getTableDate();
  },
  mounted(){
  },
  methods: {
    dateChange(){  /**选择日期监听 */
      let self = this;
      self.CZForm.HYDay = self.timestampToTime(self.searchList.time,'yy-mm-dd')
    },
    ceditSub(){ /**点击提交导出或打印 */
      let self = this;
      let _data = {
        HYDay:self.CZForm.HYDay,BJSelect:self.CZForm.BJSelect,BBSelect:self.CZForm.BBSelect
      }
      self.ceditDialog = false
      if(_data.BJSelect == 1 && _data.BBSelect == 1){ //_data.HYDay
        self.printFac({date:'2017-07-12',printType:_data.BBSelect},(res) => {
          // return
          self.xhdbReagent = res.content.xhdbReagent==null ?  false : res.content.xhdbReagent
          setTimeout(()=>{
            self.$print(self.$refs.print_1)
          },300)
        }) 
      }
      if(_data.BJSelect == 1 && _data.BBSelect == 2){
        self.printFac({date:'2017-07-12',printType:_data.BBSelect},(res) => {
          setTimeout(()=>{
            self.$print(self.$refs.print_2)
          },300)
        })
      }
      if(_data.BJSelect == 1 && _data.BBSelect == 3){
        self.printFac({date:'2017-07-12',printType:_data.BBSelect},(res) => {
          setTimeout(()=>{
            self.$print(self.$refs.print_3)
          },300)
        })
      }
     
    },
    printFac(data ,callback){ //pdf 打印
      let self = this
      self.loading = true;
      api.selectPrintList(data).then(res => {
        if(res.statusCode == 200){
            self.loading=false;
            self.PDFData = res.content
            // self.alterData(self.PDFData)
              // return 
              if(res.content.xhdbList != null && res.content.assayResultList == null ){
                callback(res)
              }else if(res.content.assayResultList != null && res.content.xhdbList == null){
                callback(res)
              }else{
                self.$message.error('暂无数据，无法打印！') 
              }
        }else{
          self.loading=false;
        }
      }).catch(reason => {
        self.loading=false;
      })
    },
    alterData(data){ //重构data数据
      let arr=data.xhdbList ? data.xhdbList :false
      let len = arr.length;
      let n = 23;
      let lineNum = len % n === 0 ? len / n : Math.floor( (len / n) + 1 );
      let res = [];
      for (let i = 0; i < lineNum; i++) {
        let temp = arr.slice(i*n, i*n+n);
        res.push(temp);
      }
      data.xhdbList = res
      console.log(data)
    },
    setSelectDefuVal(){/**修改dialog数据里面第一次编辑对应四个select默认值显示 */
           let self = this;
           self.dialogData.hbsAg='1';
           self.dialogData.hcv='1';
           self.dialogData.syphilis='1';
           self.dialogData.hiv='1';
    },
    getTableDate(){/**获取表格数据 */
      let self = this,
      getData={
        time:self.timestampToTime(self.searchList.time?self.searchList.time:new Date(),'yy-mm-dd'),
        name:self.searchList.name,
        smallNo:self.searchList.smallNo,
        currentPage:self.pagination.currentPage,
        pageSize:self.pagination.pageSize
      };
      self.loading = true;

      api.samplesList(getData).then(res=>{
        
        self.loading=false;
        self.tableData=res.content.records;
        self.pagination.total=res.content.total;
      },error=>{
        self.loading=false;
      })
    },
    searchData(){/**点击搜索 */
      this.pagination.currentPage=1;
      this.getTableDate();
    },
    handleSizeChange(size){/**修改分页显示也是 */
      this.pagination.currentPage=1;
      this.pagination.pageSize=size;
      this.getTableDate();
    },
    handleCurrentChange(current){/**切换分页*/
      this.pagination.currentPage=current;
      this.getTableDate();
    },
    updateDialog(row){/**点击编辑 */
      let self = this;
      self.dialog.isShow = true;
      self.dialogData = row;
      /**格式化dialogData数据 */ 
      self.dialogData.sampleTypeFormatter= row.sampleType===1?'血液':(row.sampleType===0?'血浆':'');
      self.dialogData.wholeBloodLevel = row.wholeBloodLevel===null? '0': String(row.wholeBloodLevel);
      self.dialogData.inspectionResult = row.inspectionResult===null? '0':String(row.inspectionResult);
      self.dialogData.hbsAg = row.hbsAg===null?'0':String(row.hbsAg);
      self.dialogData.hcv = row.hcv===null?'0':String(row.hcv);
      self.dialogData.syphilis = row.syphilis===null?'0':String(row.syphilis);
      self.dialogData.hiv = row.hiv===null?'0':String(row.hiv);
      self.dialogData.alt = row.alt===null? null:(row.alt);
      self.dialogData.bloodType = row.bloodType===null?null:String(row.bloodType);
      self.dialogData.ym = row.ym ===null?'':String(row.ym);
      self.dialogData.gatheringPlaceFormatter = row.gatheringPlace===0?'站内':'站外';
      self.dialogData.authMethodFormatter = row.authMethod == 0 ? '人工认证' : (row.authMethod == 1 ? '人脸识别' : (row.authMethod  == 2 ? '指纹认证' : ""));
      if(self.dialogData.hcv ==null || self.dialogData.hcv ==='0'|| self.dialogData.hcv =="")
      self.setSelectDefuVal();
    },
    submitDialog(){/** 更新后台信息*/
      let self = this;
      self.loading=true;
      api.addUpdataCheckRecordInfo(self.dialogData).then(res=>{
        self.loading=false;
        self.dialog.isShow=false;
        self.$message.success('信息编辑成功！');
        self.getTableDate();
        self.dialog1.isShow = false;
      },error=>{
        self.loading=false;
      })
     }
  }
}
</script>
<style lang="stylus" scoped>
.checkNote
 width 560px
 background $auxiliary-color1

.HYDay
 width 215px

.editDialog
  padding-left: 90px
</style>
<style>
.wid100{width: 100%;}
.psfBox1 .psfTitle{text-align: center;font-size: 20px;}
.psfBox1 .psfDate{border-top: 1px #303133 solid;width: 100%;text-align: right;}
.psfBox1 .el-table{width: 100%;overflow-x: hidden;}
.psfBox1 .el-table thead th{ background-color: transparent !important;}
.psfBox1 .el-table--scrollable-x .el-table__body-wrapper {
    overflow-x: hidden !important;
}
/* 自定义table */
.customTable table{background-color: #fff;} 
.customTable td{padding: 5px;text-align: center;}
.customTable1 td{padding: 5px 0;text-align: center;}
</style>
<style type="text/css" media="print">
    /* @page 
    {
        size: auto;
        margin: 0mm;
    } */
/* table {page-break-after:always;} */
</style>



